package com.flame.workflow.exception;

import java.text.MessageFormat;

import com.flame.core.exception.ExceptionLevel;
import com.flame.core.exception.ExceptionMessage;

public enum WorkflowExcetionMessage implements ExceptionMessage {
    DELETE_FAILED_MODEL_NOT_UNACTIVE("10001", "删除失败，该流程已启用", ExceptionLevel.INFO),
    MODEL_EXIST("10001", "添加失败，模型已存在", ExceptionLevel.INFO),
    NO_AVALIABLE_VERSION("10001", "启用失败，该流程尚未发布可用版本", ExceptionLevel.INFO),
    EXPRESSION_INVILID("10001", "表达式格式错误", ExceptionLevel.INFO),
    INSTANCE_NOT_FOUND("10001", "查询失败，流程不存在", ExceptionLevel.INFO),
    FILE_EXIST("10001", "操作失败，文件已存在", ExceptionLevel.INFO),
    FILE_NOT_EXIST("10001", "操作失败，文件不存在", ExceptionLevel.INFO);

    private String code;

    private String message;

    private ExceptionLevel level;

    WorkflowExcetionMessage(String code, String message, ExceptionLevel level) {
        this.code = code;
        this.message = message;
        this.level = level;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public String getMessage(Object... args) {
        return MessageFormat.format(this.message, args);
    }

    @Override
    public ExceptionLevel getLevel() {
        return level;
    }
}
